﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VISS.API.Users;
using NCT.Framework;

namespace VISS.Web.Frontend.Modules.User.Profile {

    public partial class GeneralConditionControl : System.Web.UI.UserControl {

        public bool IsEditPersional { get; set; }
        public UserGeneralConditionEnt GeneralCondition { get; set; }

        protected short CityID;
        protected short JobID;

        protected const string DontCare = "Không quan tâm";

        protected void Page_Load(object sender, EventArgs e) {

            if (GeneralCondition != null) {
                CityID = ConvertUtils.ToShort(GeneralCondition.CityIDs.Split(new string[] { "," }, StringSplitOptions.None)[0]);
                JobID = ConvertUtils.ToShort(GeneralCondition.JobIDs.Split(new string[] { "," }, StringSplitOptions.None)[0]);
                if (GeneralCondition.CityIDs == "-1") {
                    GeneralCondition.Cities = DontCare;
                }
                if (GeneralCondition.JobIDs == "-1")
                {
                    GeneralCondition.Jobs = DontCare;
                }
                if (GeneralCondition.EducationID == -1) {
                    GeneralCondition.Education = DontCare;
                }
                if (GeneralCondition.ReligionID == -1) {
                    GeneralCondition.Religion = DontCare;
                }
                if (GeneralCondition.MaritalStatusID == -1) {
                    GeneralCondition.MaritalStatus = DontCare;
                }
                if (GeneralCondition.SmokingID == -1) {
                    GeneralCondition.Smoking = DontCare;
                }
            }
        }
    }
}